package com.google.code.dajly.model;

import java.util.LinkedList;

import junit.framework.TestCase;

public class FilterTypeTest extends TestCase {
	
	private FilterType _t;

	protected void setUp() throws Exception {
		super.setUp();
		_t = new FilterType();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testIsAuthor() {
		assertFalse(_t.isAuthor());
		_t.setType("author");
		assertTrue(_t.isAuthor());
		_t.setType(null);
		assertFalse(_t.isAuthor());
		_t.setType("all");
		assertTrue(_t.isAuthor());
	}

	public void testIsDescription() {
		assertFalse(_t.isDescription());
		_t.setType("description");
		assertTrue(_t.isDescription());
		_t.setType(null);
		assertFalse(_t.isDescription());
		_t.setType("all");
		assertTrue(_t.isDescription());
	}

	public void testIsTitle() {
		assertFalse(_t.isTitle());
		_t.setType("title");
		assertTrue(_t.isTitle());
		_t.setType(null);
		assertFalse(_t.isTitle());
		_t.setType("all");
		assertTrue(_t.isTitle());
	}

	public void testIsBusiness() {
		assertFalse(_t.isBusiness());
		_t.setType("business");
		assertTrue(_t.isBusiness());
		_t.setType(null);
		assertFalse(_t.isBusiness());
		_t.setType("all");
		assertTrue(_t.isBusiness());
	}

	public void testIsLocation() {
		assertFalse(_t.isLocation());
		_t.setType("location");
		assertTrue(_t.isLocation());
		_t.setType(null);
		assertFalse(_t.isLocation());
		_t.setType("all");
		assertTrue(_t.isLocation());
	}

	public void testGetFilter() {
		_t.setFilter("prova","test");
		LinkedList<String> _c = new LinkedList<String>();
		_c.add("prova");
		_c.add("test");
		assertTrue(_t.getFilter().containsAll(_c));
	}

}
